<%@ page language="java" contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8"  trimDirectiveWhitespaces="true" session="false" %>
<%@include file="../include/taglibs.jsp"%>
<%@include file="../include/urls.jsp"%>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<c:set var="gameUrl" value="${gamesUrl}${game.id}/" />

<game>
	<link rel="self" href="${gameUrl}" />
	<id>${game.id}</id> 
	<title>${game.title}</title>
	<size>${game.size}</size>
	<description>${game.description}</description>
	<creationTime>${game.creationTime}</creationTime>
	<owner>
		<link rel="self" href="${playersUrl}${game.owner.name}" />
		<name>${game.owner.name}</name>
	</owner>
	<c:if test="${game.winner != null}">
	<winner>
		<link rel="self" href="${playersUrl}${game.winner.name}" />
		<name>${game.winner.name}</name>
	</winner>
	</c:if>
	<buzzwords>
		<c:forEach var="buzzword" items="${game.buzzwords}">
		<buzzword>${buzzword}</buzzword>
		</c:forEach>	
	</buzzwords>
	<players>
		<c:forEach var="player" items="${game.players}">
		<player>
			<link rel="self" href="${playersUrl}${player.name}" />
			<name>${player.name}</name>
		</player>
		</c:forEach>
	</players>
	<boards>
		<c:forEach var="board" items="${game.boards}">
		<board>
			<link rel="self" href="${boardsUrl}${board.id}" />
		</board>
		</c:forEach>
	</boards>
</game>